<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p>
    <label>Username：<input id="username"></label>
</p>
<p>
    <label>Password：<input id="password"></label>
</p>
<button onclick="login()">Sign in</button>

<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script>
    function login() {
        $.ajax({
            url: "/login",
            type: 'post',
            data: {
                username: $("#username").val(),
                password: $("#password").val()
            },
            success: function (data) {
                alert(data);
            }
        });
    }
</script>

</body>
</html>